package com.stone.design.patterns.filter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Stone
 * @version V1.0
 * @description:
 * @date 4/29/18 22:51
 * @email redsstone@163.com
 */
public class CriteriaMobileCommunication implements Criteria{

    private List<Student> mStudents = new ArrayList<>();
    @Override
    public List<Student> meetCriteria(List<Student> students) {

        List<Student> mobileCommunicationStudents = new ArrayList<>();
        for (Student student : students) {
            if (student.getSpecializedSubject().equals(SpecializedSubjectCode.MOBILE_COMMUNICATION)) {
                mobileCommunicationStudents.add(student);
            }
        }
        return mobileCommunicationStudents;
    }

    @Override
    public int getCount() {
        return mStudents.size();
    }
}
